//
//  TripListTblCell.m
//  RoadLine
//
//  Created by dllo on 15/4/21.
//  Copyright (c) 2015年 RedFireNoodles. All rights reserved.
//
//KennethWang途行精选的自定义cell界面
#import "TripListTblCell.h"
#import "HighQualityTripModel.h"
#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height

@implementation TripListTblCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        //底部的黑色衬托VIew
        self.bottomView = [[UIView alloc]init];
        self.bottomView.layer.cornerRadius = 8;
//        self.bottomView.backgroundColor = [UIColor colorWithRed:79/255.0 green:193/255.0 blue:208/255.0 alpha:1];
        self.bottomView.backgroundColor = [UIColor blackColor];
        self.bottomView.alpha = 1;
        [self.contentView addSubview:self.bottomView];
        [_bottomView release];
        
        //途行精选 的图片ImageView
        self.highQualityImageView = [[UIImageView alloc]init];
        self.highQualityImageView.backgroundColor = [UIColor grayColor];
        //以下三行代码 图片自适应相框(避免因比例不合适图片被拉伸)
        self.highQualityImageView.contentMode = UIViewContentModeScaleAspectFill;
        self.highQualityImageView.autoresizesSubviews = YES;
        self.highQualityImageView.clipsToBounds = YES;
         //以下两行代码 图片变圆角;
        self.highQualityImageView.layer.cornerRadius = 8;
        self.highQualityImageView.clipsToBounds = YES;
        [self.bottomView addSubview:self.highQualityImageView];
        [_highQualityImageView release];
        
        //标题底部的白色衬托VIew
        self.highQualityNameLabelView = [[UIView alloc]init];
        self.highQualityNameLabelView.backgroundColor = [UIColor whiteColor];
        self.highQualityNameLabelView.alpha = 0.5;
        [self.bottomView addSubview:self.highQualityNameLabelView];
        [_highQualityNameLabelView release];
        
        //途行精选的标题的Label
        self.highQualityNameLabel = [[UILabel alloc]init];
        self.highQualityNameLabel.backgroundColor = [UIColor clearColor];
        self.highQualityNameLabel.textColor = [UIColor blackColor];
        self.highQualityNameLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:16];
        self.highQualityNameLabel.font = [UIFont boldSystemFontOfSize:18];
        self.highQualityNameLabel.numberOfLines = 1;
        [self.highQualityNameLabel sizeToFit];
        [self.bottomView addSubview:self.highQualityNameLabel];
        [_highQualityNameLabel release];
        
        //足迹数量的黑色衬托View
        self.highQualityFoorPrintCountView = [[UIView alloc]init];
        self.highQualityFoorPrintCountView.backgroundColor = [UIColor blackColor];
        self.highQualityFoorPrintCountView.alpha = 0.6;
        [self.bottomView addSubview:self.highQualityFoorPrintCountView];
        [_highQualityFoorPrintCountView release];
        
        //足迹数量的Label
        self.highQualityFoorPrintCountLabel = [[UILabel alloc]init];
        self.highQualityFoorPrintCountLabel.backgroundColor = [UIColor clearColor];
        self.highQualityFoorPrintCountLabel.font = [ UIFont fontWithName:@"Helvetica-Bold" size:12];
        self.highQualityFoorPrintCountLabel.textColor = [UIColor whiteColor];
        [self.bottomView addSubview:self.highQualityFoorPrintCountLabel];
        [_highQualityFoorPrintCountLabel release];
        
    
        
  
        
    }
    return self;
}

 -(void)layoutSubviews
{
    [super layoutSubviews];
    self.highQualityImageView.frame = CGRectMake(3, 2, WIDTH-40, HEIGHT-15);
    self.highQualityNameLabel.frame = CGRectMake(20, 15, WIDTH-60, 15);
    self.highQualityFoorPrintCountLabel.frame = CGRectMake(20, 132, 150, 10);
    self.highQualityFoorPrintCountView.frame = CGRectMake(3, 130, WIDTH-40, 15);
    self.highQualityNameLabelView.frame = CGRectMake(2, 5, WIDTH-40, 35);
    self.bottomView.frame = CGRectMake(15, 10, WIDTH-33, HEIGHT-10);
  
    if ([Singleton shareSingleton].isNight) {
        [[Singleton shareSingleton] loadNightModeInfoFormDisk];
    }
}

- (void)setLightDayModel {
    self.contentView.backgroundColor = [UIColor colorWithRed:250/255.0 green:245/255.0 blue:232/255.0 alpha:1];
}

- (void)setNightDayModel {
    self.contentView.backgroundColor = [UIColor blackColor];
}

- (void)dealloc
{
    [_bottomView release];
    [_highQualityNameLabel release];
    [_highQualityImageView release];
    [_highQualityFoorPrintCountLabel release];
    [_highQualityFoorPrintCountView release];
    [_highQualityNameLabelView release];
    [super dealloc];
}

@end
